#include <iostream>
#include <mutex>
#include <thread>
using namespace std;
mutex Lock;
void funca(int n) {
    for (int i = 1; i <= n; ++i) {
        Lock.lock();
        cout << "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" << endl;
        Lock.unlock();
    }
}
void funcb(int n) {
    for (int i = 1; i <= n; ++i) {
        Lock.lock();
        cout << "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" << endl;
        Lock.unlock();
    }
}
int main() {
    thread a, b;
    a = thread(funca, 30);
    b = thread(funcb, 20);
    a.join();
    b.join();
    return 0;
}